package com.jingogo.controller;

import com.jingogo.common.Result;
import com.jingogo.entity.AuditLog;
import com.jingogo.service.AuditLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/audit")
@Tag(name = "审计日志", description = "审计日志接口")
public class AuditController {
    @Autowired
    private AuditLogService auditLogService;

    @GetMapping("/list")
    @Operation(summary = "审计日志列表", description = "获取审计日志列表")
    @PreAuthorize("hasRole('ADMIN')")
    public Result<List<AuditLog>> listAuditLog(@RequestParam(required = false) String keyword) {
        return Result.success(auditLogService.listAuditLog(keyword));
    }
} 